package com.wang.pojo;

import java.util.Date;
import java.util.Map;
import java.util.TreeMap;

import com.wang.common.pojo.BasePojo;

public class ASensitiveWords extends BasePojo<ASensitiveWords>
{
	private int id;
	private String name;
	private String content;
	private byte swType;
	private byte status;
	private Date createTime;
	private Date updateTime;
	private Date pubTime;
	
	/* 字符串描述 */
	private String statusStr ; 
	private String swTypeStr;
	
	/*  枚举值 */
	private Map<String,Object> enumsMap = new TreeMap<String, Object>();
	
	/**
	 * 获取一个map;
	 * map有两个要素：键和值,而枚举有三个要素:code,info,枚举项
	 * @return	map的键是:枚举项-code值,值是:info
	 */
	public Map<String, Object> getEnumsMap()
	{
		for(ASensitiveWordsEnum enumTemp : ASensitiveWordsEnum.values())
		{
			enumsMap.put(enumTemp.toString() + "-" + enumTemp.getCode(), enumTemp.getInfo());
		}
		return enumsMap;
	}
	
	/**
	 * 根据status的值,和枚举中对应的值,
	 * 返回枚举对应的字符串
	 * @return
	 */
	public String getStatusStr()
	{
		for(ASensitiveWordsEnum enumTemp : ASensitiveWordsEnum.values())
		{
			if(enumTemp.toString().startsWith("STATUS_")
				&& enumTemp.getCode() == this.getStatus())
			{
				return enumTemp.getInfo() ; 
			}
		}
		return statusStr;
	}
	
	/**
	 * 根据swType的值,和枚举中对应的值,
	 * 返回枚举对应的字符串
	 * @return
	 */
	public String getSwTypeStr()
	{
		for(ASensitiveWordsEnum enumTemp : ASensitiveWordsEnum.values())
		{
			if(enumTemp.toString().startsWith("SWTYPE_")
				&& enumTemp.getCode() == this.getSwType())
			{
				return enumTemp.getInfo() ; 
			}
		}
		return swTypeStr;
	}
	

	public int getId()
	{
		return id;
	}

	public void setId(int id)
	{
		this.id = id;
	}

	public String getName()
	{
		return name;
	}

	public void setName(String name)
	{
		this.name = name;
	}

	public String getContent()
	{
		return content;
	}

	public void setContent(String content)
	{
		this.content = content;
	}

	public byte getSwType()
	{
		return swType;
	}

	public void setSwType(byte swType)
	{
		this.swType = swType;
	}

	public byte getStatus()
	{
		return status;
	}

	public void setStatus(byte status)
	{
		this.status = status;
	}

	public Date getCreateTime()
	{
		return createTime;
	}

	public void setCreateTime(Date createTime)
	{
		this.createTime = createTime;
	}

	public Date getUpdateTime()
	{
		return updateTime;
	}

	public void setUpdateTime(Date updateTime)
	{
		this.updateTime = updateTime;
	}

	public Date getPubTime()
	{
		return pubTime;
	}

	public void setPubTime(Date pubTime)
	{
		this.pubTime = pubTime;
	}

}
